#pragma once
#include "stdafx.h"
#include <boost/noncopyable.hpp>
#include <event2/event.h>
#include <event2/buffer.h>
#include <event2/bufferevent.h>
#include <boost/shared_ptr.hpp>
#include "Element.h"


class ClientIOManager:private boost::noncopyable
{
private:
	static ClientIOManager * ioManager;
	//the thread function. loop and check if some event is ready, if yes,  the registered function handler would be called
	void createNewThreadToPerfromIO(void);
public:

	 
	struct event_base * base;
	ClientIOManager(void);
	~ClientIOManager(void);
	static ClientIOManager* getInstance(void);
	//receive the input stream by socket 
	void addStreamInput(std::string ip,std::string port, void (*callBackFunction)(Element& element));

	//create a new thread to deal with the IO
	void execute(void);


	 
	 
};

